/*
 * Copyright 2014-2020 Real Logic Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>

extern "C"
{
#include "util/aeron_math.h"
}

class MathTest : public testing::Test
{
public:
    MathTest() = default;
};

TEST_F(MathTest, shouldApplyBasicAdditionWrapping)
{
    EXPECT_EQ(aeron_add_wrap_i32(INT32_MAX, 1), INT32_MIN);
    EXPECT_EQ(aeron_add_wrap_i32(INT32_MIN, -1), INT32_MAX);
    EXPECT_EQ(aeron_add_wrap_i32(INT32_MIN, INT32_MIN), 0);
    EXPECT_EQ(aeron_add_wrap_i32(INT32_MAX, INT32_MAX), -2);
    EXPECT_EQ(aeron_add_wrap_i32(INT32_MAX, -INT32_MAX), 0);
}

TEST_F(MathTest, shouldApplyBasicSubtractionWrapping)
{
    EXPECT_EQ(aeron_sub_wrap_i32(INT32_MIN, 1), INT32_MAX);
    EXPECT_EQ(aeron_sub_wrap_i32(INT32_MAX, -1), INT32_MIN);
    EXPECT_EQ(aeron_sub_wrap_i32(INT32_MIN, INT32_MIN), 0);
}

TEST_F(MathTest, shouldApplyBasicMultiplyWrapping)
{
    EXPECT_EQ(aeron_mul_wrap_i32(INT32_MAX / 2, INT32_MAX / 2), -2147483647);
    EXPECT_EQ(aeron_mul_wrap_i32(INT32_MAX / 2, 5), 1073741819);
}

TEST_F(MathTest, shouldWrapAdditionFromMaxToMinPositiveOverflow)
{
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            EXPECT_EQ(aeron_add_wrap_i32(INT32_MAX - j, (i + j + 1)), INT32_MIN + i);
        }
    }
}

TEST_F(MathTest, shouldWrapAdditionFromMinToMaxNegativeOverflow)
{
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            EXPECT_EQ(aeron_add_wrap_i32(INT32_MIN + j, -(i + j + 1)), INT32_MAX - i);
        }
    }
}

TEST_F(MathTest, shouldWrapSubtractionFromMaxToMinPositiveOverflow)
{
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            EXPECT_EQ(aeron_sub_wrap_i32(INT32_MAX - j, -(i + j + 1)), INT32_MIN + i);
        }
    }
}

TEST_F(MathTest, shouldWrapSubtractionFromMinToMaxNegativeOverflow)
{
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            EXPECT_EQ(aeron_sub_wrap_i32(INT32_MIN + j, (i + j + 1)), INT32_MAX - i);
        }
    }
}

TEST_F(MathTest, shouldNotWrapWhenNoOverflow)
{
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            EXPECT_EQ(aeron_add_wrap_i32(i, j), i + j);
            EXPECT_EQ(aeron_add_wrap_i32(i, -j), i - j);
        }
    }
}

TEST_F(MathTest, shouldWrapMultiplyGeneratedExamples)
{
    //<editor-fold desc="Example Wrapping Values generated by Java code">
    int32_t examples[1000][3] =
    {
        {45463405,    1725651321,  -857237627},
        {-1610160479, -1128590487, -645035255},
        {-1662394276, 1299315045,  404422732},
        {1976076958,  710475788,   -1571520664},
        {-922934684,  852948013,   -522298476},
        {-229832338,  1405455347,  -1092309654},
        {-378750235,  2004705100,  1517516540},
        {1714016155,  1732167440,  -2021099856},
        {-592638277,  -1214725725, 1716739089},
        {-847882716,  -1189655248, -548078912},
        {-1084342846, 767064750,   2028760540},
        {-1499477084, -1963220404, -1474675536},
        {188213916,   -749344520,  76850976},
        {-1871991885, -280985570,  -868770054},
        {-1786561871, -763755567,  -1003684479},
        {1065478283,  290449655,   -17148387},
        {-1746513289, -1665770435, 471755355},
        {1983744750,  1196692431,  -987037582},
        {-1061891597, 1861794094,  429806762},
        {1544350791,  -1952676451, -1292776821},
        {-382921346,  -1635794186, -1457642732},
        {-1164382449, 1999301609,  1780111783},
        {675430092,   -458591754,  1356358664},
        {-931341966,  -2019914594, -259224484},
        {1947159082,  348337307,   642805614},
        {-1446070735, 1785618212,  700173796},
        {1393538054,  -2088566645, 1251524418},
        {944922569,   -1811995986, 216845470},
        {1962832564,  -1424506086, 1029882440},
        {-433088043,  -2113665584, -2046679536},
        {-1576777617, -1287854846, -1344807970},
        {950394032,   1984279379,  -226124528},
        {-1041583715, -492055213,  1656633063},
        {-490817698,  246732876,   1299038184},
        {-862391466,  957730728,   221264496},
        {-1935021140, 303724395,   -821398300},
        {91557415,    -1774759525, 1002104989},
        {-780359531,  -718692976,  1113535696},
        {-1130718958, -1498877062, -1060566892},
        {-1799387418, 1478445987,  944916082},
        {-9058087,    152606778,   1162369322},
        {164441125,   1385605540,  1900197044},
        {-1234098309, -1445910357, -97806551},
        {1253947311,  -821766400,  -1258292992},
        {-79118338,   -1910092307, -405986266},
        {968449567,   1253108775,  1498540729},
        {1400750703,  1220337442,  -1533639746},
        {1347344118,  -281935526,  815433852},
        {-2003704793, 436205156,   -1676437188},
        {-1961852808, -523874615,  -1813418440},
        {878837839,   -1868701447, 1409969367},
        {-2038080044, -1770800676, 1504106032},
        {-1486111579, 65494725,    -1928347399},
        {1135170439,  521364432,   15078064},
        {2034382463,  -526457601,  -2082511743},
        {-1475721727, 1315900806,  593342854},
        {87161872,    -814950361,  1040901744},
        {1313209991,  1487955095,  -410657375},
        {-27994647,   -972492489,  1726107151},
        {1770453595,  -36729429,   866277833},
        {-1688591166, 410534424,   954037808},
        {-2015590373, 1135575051,  905730345},
        {324065147,   1371704663,  1298004429},
        {-1238575258, -513014157,  1748575954},
        {-32752291,   -1569135336, 1638003128},
        {-1555702075, 38172972,    -1976867108},
        {-460506972,  -359479990,  -219114648},
        {-1199817785, 1474004314,  720922358},
        {-328362687,  449191196,   1344974876},
        {-208309907,  -1826777710, 1452810538},
        {350455771,   -489555026,  -2002448422},
        {-2119358264, 523546543,   -2065721160},
        {1087346967,  1434113035,  1269342205},
        {1939560416,  1243470822,  1981649728},
        {396853528,   -2089644969, 1765146408},
        {1281061592,  569469206,   122582672},
        {859092809,   -1420440508, 978049892},
        {-279770289,  72917604,    683698396},
        {-1304053159, -779403574,  1702467642},
        {-1990688248, -718222841,  -1585062344},
        {-52603769,   -1503085801, 1165571361},
        {1245753036,  -1025348256, 1254516864},
        {-1386520545, 248350915,   1115533213},
        {532980366,   2010211917,  -1630046026},
        {1338953795,  1520448327,  230235029},
        {2080303056,  968564157,   274969744},
        {626590190,   -661544785,  282792370},
        {-1949178554, 924705671,   -588580374},
        {-1048143562, -1636933745, 910073642},
        {41895608,    -1457688713, -743725176},
        {453144272,   -731750349,  -156626064},
        {-774729684,  1527111594,  910561592},
        {1011569113,  -685601511,  2101445425},
        {935280451,   147834907,   -1983577071},
        {-597843501,  204666531,   -933967015},
        {-1921704221, 555558781,   -1399084585},
        {-959576851,  867665416,   -915458712},
        {787722518,   642798922,   387808860},
        {-1629307258, 2007526283,  1555002562},
        {-1085287631, -623166181,  -1750535381},
        {1980590579,  2276336,     -1958882096},
        {2070741048,  -671712454,  -1818430288},
        {738139520,   -1289686742, -1834985728},
        {1562236288,  953495157,   -1904241792},
        {699218357,   846086744,   573734968},
        {-1984578154, -798780620,  -2050382728},
        {-784504615,  -1872558350, -663932126},
        {324003167,   1777056718,  1812723570},
        {-952921413,  1915197759,  2027937541},
        {28172160,    -287507945,  81925248},
        {-576403281,  1993738,     -1315198250},
        {416455167,   -626536899,  -42802237},
        {81685975,    -1578285164, 1746477388},
        {-22771158,   577334996,   -757434680},
        {-702472285,  -827792948,  -1406437148},
        {1881944759,  -297845202,  2034396898},
        {2030248602,  1646609853,  602279346},
        {-927832020,  382451952,   1481025856},
        {856053593,   -777994681,  473319343},
        {1934882689,  -267807,     -208932511},
        {-1893073956, 455489553,   1200216476},
        {550933251,   -340472059,  1143753743},
        {-385827588,  1868517054,  -1918563576},
        {300231034,   1493113834,  -950155388},
        {945282104,   -597853858,  1471239312},
        {530058126,   667342144,   -109835904},
        {939814327,   -597358042,  170159914},
        {-1148222618, -1952759377, -1741047622},
        {-1472728435, -985926300,  -1468354540},
        {472760977,   -230421531,  -321960267},
        {990761789,   103388076,   -530910212},
        {-1964553687, -759303699,  -1221246731},
        {890732158,   -1141648553, -2083006766},
        {275722549,   1602393543,  637344051},
        {2076520514,  -436630227,  1466946970},
        {-420025009,  -1457241292, 274718988},
        {2095424755,  -313462687,  546787347},
        {1947173254,  1165999824,  775205088},
        {1565998335,  -506709571,  271634243},
        {2083796869,  -917278106,  715544830},
        {1168725142,  -264885731,  598946046},
        {-1746581772, -1624470913, -1326597364},
        {-1978346574, -197464031,  -243652110},
        {532352797,   747624764,   1826234316},
        {740244055,   1854503197,  1554758363},
        {541116114,   -28470683,   -736348966},
        {-1347703525, -1878762156, -425485348},
        {-370162034,  1816933569,  -331249394},
        {393332201,   -459744410,  -1308938794},
        {1536348378,  -318229337,  -402487754},
        {-1106629375, -1765435642, -1400003322},
        {-1746207502, 516635605,   2125871962},
        {-1791148478, 1598164719,  949533598},
        {-656005208,  1769411199,  537885784},
        {-1925169493, 1171455512,  2071562760},
        {223415943,   1693287851,  816568109},
        {-1252923873, 543628326,   1439468698},
        {-806520518,  -689971525,  -417474210},
        {1190084968,  -1352994527, 2012894824},
        {-1569254097, -463093685,  542209221},
        {-1192873859, -1199984534, -1816460350},
        {-1566054537, -647726020,  -1124867100},
        {807077127,   826035948,   420791412},
        {-990414609,  -691194095,  -523411233},
        {-315947743,  1931954322,  -150915886},
        {-18997084,   -1840681863, 59153796},
        {2020464223,  1580910840,  -311958520},
        {1394086003,  -1420646100, 1087684292},
        {1433670930,  -328193180,  -1329446648},
        {-335935504,  -1674867206, -1109725088},
        {-2076075063, -109378057,  1038826479},
        {77844873,    -167940064,  1904943392},
        {1566981913,  1119040543,  -1532119033},
        {1610280426,  -138466595,  1312671490},
        {-1090518623, -143616945,  -10382161},
        {639242657,   213841476,   -849648444},
        {-1478622136, -1585943310, -1553044464},
        {-863479547,  -755869869,  -416313441},
        {1672197832,  -223892324,  1743372768},
        {-447392172,  -1077117627, -233355100},
        {864029808,   -805013118,  -559464224},
        {1936023067,  -1249075164, 584457164},
        {-777733851,  638895148,   452208220},
        {1896592858,  268121249,   -1945393638},
        {2049292969,  100585832,   -312095320},
        {935758055,   665192743,   1893268017},
        {-201739745,  -908857471,  883602079},
        {919259026,   -1558667219, 168842410},
        {-459812402,  -2018194767, -10708114},
        {273437833,   1469012939,  -702891101},
        {-103259355,  -1568533293, -1746756737},
        {-1655626626, -75936112,   5303008},
        {-397858562,  1925411932,  -162016440},
        {866399238,   -1643788910, -2016654996},
        {518988326,   -1365643637, 1514987170},
        {-1285064764, 624418757,   1057940948},
        {1761832989,  -1288552225, -2102400701},
        {-1743639866, 13354640,    -2108738720},
        {-1965988327, 545185225,   601538209},
        {1838882606,  -1596040291, 639334710},
        {-2068315056, 1346928803,  -1177370896},
        {1684337940,  -50237456,   -1644335424},
        {1588683639,  1059032288,  839195680},
        {930896811,   -797714373,  -724408215},
        {-1008282491, 531082371,   329980943},
        {2132197538,  -204082577,  -1446991298},
        {-520046404,  1515872725,  -2052001684},
        {-817753652,  287862934,   -1403015800},
        {-984787479,  1953792081,  -1711231303},
        {2124182786,  -1922269985, -1982929730},
        {1456089833,  -1148337949, 1791478939},
        {-1661658552, -115766534,  9337424},
        {-540047249,  -1885805231, 2023585311},
        {-601519058,  1192127142,  -1192758828},
        {-2099875323, 1576935161,  1441234141},
        {-125492616,  -437751929,  1558656328},
        {-506655920,  1835576508,  1051594432},
        {1884191488,  721732156,   -1214589952},
        {-219277929,  1174135866,  -214409162},
        {476650715,   639446705,   1319849323},
        {156516741,   204675647,   602055099},
        {-276321861,  1639121840,  -855449200},
        {1003116846,  -2131550596, 1394644552},
        {-726842989,  -1936730178, 1606819866},
        {-1931114929, 1854619257,  233348439},
        {1379073152,  -456308956,  -441253376},
        {75970777,    869204938,   1523869242},
        {1418764007,  710016843,   29206189},
        {-1866960464, 1800479104,  -1416591360},
        {-759567398,  516139853,   -981168494},
        {1252554159,  -1604631326, -584097666},
        {-15451713,   1087542727,  755175033},
        {817179887,   -725238435,  -202848813},
        {1914580275,  -1447226380, 197451164},
        {-1744588215, -1249038408, -1080521864},
        {1495121451,  993398263,   -2073253251},
        {1536415512,  -1623996277, -82277880},
        {-1043928228, -1296353161, 2066188228},
        {-64905405,   -1847680527, -1880485613},
        {-837828643,  -1558391951, -1555900531},
        {-1747715718, 1995919484,  -1185351912},
        {126652169,   -1094581688, 1266175112},
        {2062038975,  1512360809,  -1974513065},
        {1777961641,  -1840115424, -1651995104},
        {1870531623,  -1527897068, -1211076852},
        {-1354426541, -1323549843, 2094993239},
        {1252003297,  -359874386,  71184110},
        {784368396,   404539334,   1142140744},
        {736168567,   932908588,   -1068675468},
        {1666384436,  -82342657,   -2087738932},
        {-1415141548, 849862018,   -1730118488},
        {870651555,   1714238581,  754152575},
        {-1094838395, 646307856,   915331152},
        {335070478,   -825111125,  -1318726054},
        {1549789635,  -2135820452, -589945068},
        {1388657839,  1583384341,  -791788709},
        {848573104,   -1935520766, -1214995104},
        {-1418537691, 133275700,   1130326916},
        {-1405577375, -1686413336, -1978585368},
        {-1149335912, 1205135586,  -846425552},
        {-1073873892, 633835445,   -1540693044},
        {723140640,   1046766062,  -785138240},
        {-120857758,  1302378371,  -1587261146},
        {1892794471,  117953259,   -1271849843},
        {-1303148241, -226300206,  166607502},
        {1947325580,  544958789,   943699388},
        {-260184449,  -268791872,  1530122304},
        {1403658570,  838382740,   1735608008},
        {-1711126252, 1154415990,  1566470968},
        {205511257,   -1023241164, -421147116},
        {1310563190,  -1804673563, 1952771726},
        {422186003,   -1098257899, 262626191},
        {-414385861,  2138684082,  -763549434},
        {-963224741,  254420687,   923885717},
        {-513848440,  -1383187090, 1499585648},
        {1079992250,  -694549768,  755511344},
        {-328881705,  -2126284022, -556273818},
        {1407974346,  -681707079,  1272082170},
        {-1606253830, 1923547785,  229903306},
        {-553560105,  -1836099425, -1491044727},
        {1913901663,  201368311,   272635817},
        {1743217346,  1701050542,  -2114514980},
        {766829972,   -885515111,  -1365678732},
        {-421921496,  -128977733,  1172180024},
        {2119726605,  2001219941,  103223329},
        {1270821572,  -2057572101, 1673168428},
        {-1174136027, 1072548020,  1012465156},
        {1472013841,  -1579169834, 981731638},
        {-1463658398, -1518790091, -1652015030},
        {1859162675,  712683521,   -576609741},
        {1643170812,  1251087397,  628435820},
        {-1406204137, -601935925,  -882845635},
        {1550074272,  -2128580420, -1974062720},
        {-1018281000, -879070794,  2105971600},
        {963947889,   1637560042,  1346099018},
        {-1323543708, -479998392,  -2034373600},
        {-1281404082, 1074422339,  -1046304406},
        {2072661855,  2130353955,  268098301},
        {-7496102,    1195478582,  -1601219844},
        {-481956537,  551923539,   -1654491387},
        {775122104,   1216872581,  -2106098792},
        {178010584,   -1379345177, -43134488},
        {278909846,   2001198832,  -1746112352},
        {1598170801,  -247808062,  -266772190},
        {1581752173,  -592192461,  2055040695},
        {560320054,   -246584910,  -694450292},
        {-1925114746, 165595187,   2117322418},
        {1798672824,  -1990552639, 1220510648},
        {-849562689,  -1631621261, 1880461261},
        {-1086818861, 1289014475,  -697986479},
        {-746649714,  89030092,    -1557243096},
        {-1549442793, 82083152,    -1198353872},
        {-967066298,  -1735174051, -678047122},
        {1402806506,  -2135894901, 645048078},
        {1492291225,  -481287489,  -826755545},
        {-553297748,  -2052984125, 252781316},
        {1714601821,  -1337171075, 1180985193},
        {1560330012,  -1544887072, -1904990080},
        {-1405996141, 37813187,    1838049785},
        {-303870470,  -1853930176, 98427008},
        {1353802148,  1516201556,  183984592},
        {-431536148,  -1954441781, 2035180580},
        {-462052116,  -711364159,  394887660},
        {2010265765,  -1988843708, -292639020},
        {-1416121220, -378672681,  -461803484},
        {-1014541501, -951344670,  846570534},
        {243024411,   -330177447,  -2103572637},
        {1467405048,  689537823,   -1215269880},
        {-1912011378, 320185582,   -761781756},
        {1953513964,  635053262,   -1164821528},
        {906541081,   1327451228,  64001276},
        {39307874,    2078024051,  1623100422},
        {-422263739,  541378294,   580253774},
        {555546137,   -1040963122, -1316222690},
        {-2088522270, 1269935699,  -1826423738},
        {-1152155660, -1709727815, -2101607596},
        {-129534385,  -958590400,  1415717312},
        {1012210652,  -1786410445, 1799693524},
        {-2053668616, 2103336183,  -896102584},
        {-1998759707, -847104325,  800734535},
        {-327828448,  -642791792,  -879062528},
        {-193003089,  1864047586,  1271001470},
        {651629024,   -958395465,  -444438752},
        {711237390,   1907216667,  1223505018},
        {-1322031762, -753116258,  1691268068},
        {-1027342099, -263835691,  2047756337},
        {-4087646,    -65621707,   420627338},
        {-1836650129, 43315659,    -1401490939},
        {1059624374,  -1109652584, 1156560400},
        {371816022,   -327065446,  -894996548},
        {-1380599475, 770783689,   -731012491},
        {-1108327256, 1349380755,  1799421048},
        {-1414072138, 650390942,   -1812103596},
        {1319127695,  426815698,   1213167950},
        {-1750781839, -437581316,  -1576359876},
        {420115329,   -1119985009, 860612367},
        {-375322895,  -1853267899, -1829093643},
        {-95614304,   -2104034893, 1827933664},
        {295448483,   566710542,   1817325034},
        {148791138,   -1108792146, 1773907100},
        {-391816658,  1640858645,  -52027962},
        {-1920298892, -1680168569, 1547092268},
        {544035324,   -1955320974, -945564104},
        {-1782013733, -1783599564, -1351694724},
        {-662695431,  1224902155,  2077957043},
        {-1670825124, 527684139,   1722970228},
        {924111002,   1010799949,  479354962},
        {-1461467106, 1751520568,  -1926087536},
        {-1341896671, 283900440,   -182321896},
        {-223561587,  488474513,   1780474589},
        {665108254,   1439182074,  1294715724},
        {-951440000,  1287954215,  1150250624},
        {-1119906504, 164201887,   -1275345464},
        {-980788323,  -1046180290, -1545124346},
        {701257773,   -564935288,  285243624},
        {-1198435844, -39178433,   -1758957308},
        {-270949098,  2054429179,  -1250164078},
        {-1599469814, 1731025357,  123477250},
        {1229740527,  -1720334022, 2133067558},
        {270585775,   640677141,   -728464293},
        {-1021191337, 804781815,   2000417521},
        {-1641306957, 1875598186,  948884254},
        {-957713773,  154102790,   -976112782},
        {591845981,   165143312,   -1322705712},
        {696059864,   -1317687980, 151751392},
        {-273469860,  1162059863,  1626489156},
        {-155861815,  1593028119,  -1318087665},
        {-1876144149, 2001384683,  -674457415},
        {-1624954050, -1403815610, -1028382476},
        {-1128446417, -1709916054, -592556170},
        {-290567098,  -415682996,  1393113288},
        {470440163,   -1990179273, -1431885115},
        {-1771222161, -469103369,  290651161},
        {-524394698,  -1323426675, 429414590},
        {-383661500,  1703136438,  -936},
        {1497602291,  -1217644330, -1552219358},
        {-1006938090, 1343599363,  609708610},
        {567178722,   41971005,    -1419554598},
        {-1773198849, -368042722,  -904929566},
        {943910766,   453569410,   423071708},
        {1839865635,  433484027,   1705891665},
        {249780359,   227647756,   -1395913388},
        {-1188872903, -443897476,  -298432356},
        {1614923721,  -1629831100, 377082212},
        {-1023061687, -613879326,  -1528857742},
        {-757366819,  -1996616928, 255097504},
        {1394659510,  -1568865151, 2074739638},
        {-279447009,  -16403715,   2037825187},
        {1922143871,  -675135309,  917109453},
        {-270829695,  1802559921,  -298450639},
        {1405434049,  -681923570,  566544014},
        {192363438,   558841824,   951454272},
        {592622208,   -476556583,  -364491136},
        {79681138,    2019429518,  -833467588},
        {939287974,   -1218987077, 2030600770},
        {-2144067752, 1344707062,  2145498768},
        {910276939,   1575051957,  -1622034425},
        {1957021588,  365380505,   1650197364},
        {1182128182,  -1015845039, -1505045738},
        {2139006499,  1359819161,  -213582357},
        {933581731,   -436987365,  793403441},
        {114041392,   823557446,   -1465726688},
        {502050374,   -1604291248, -1612942368},
        {2108448697,  605653753,   -2058103567},
        {-1266805873, 1955761365,  321288699},
        {1531908722,  -496521952,  -382248896},
        {448053039,   1630867818,  1933854838},
        {192289513,   2005820570,  1137521706},
        {-1132930853, 476709663,   -69545083},
        {1602245098,  1323029061,  1609959442},
        {-1323382704, 168627974,   1082483168},
        {-2100615644, 2143301076,  2096097744},
        {890848662,   -36596695,   717020422},
        {-1025642484, 63919589,    1055897276},
        {981838216,   -1995996226, 1068264176},
        {1436295168,  -255668910,  -1314766848},
        {1192116882,  -388919143,  640280898},
        {-873878864,  -1509049914, 1577268256},
        {-619269700,  122315233,   -1398640068},
        {-805349447,  1285142419,  1357225531},
        {-1696427032, -1078084346, 852082544},
        {-765274478,  1499240131,  159055158},
        {380042071,   1056299762,  941927998},
        {693157291,   -1780198036, -1336554716},
        {-830767759,  -336831362,  1627937182},
        {312793043,   -1242043576, -66034600},
        {1663555781,  1982960167,  543645699},
        {-768646183,  -1136608636, 557524452},
        {-1994950835, 492047104,   -530297088},
        {-2077480330, 2061089240,  -1443292784},
        {-2020847369, -625107222,  -1667927098},
        {125472362,   -992039977,  -856004346},
        {-675351968,  488269827,   -1754015968},
        {-612107548,  1827075976,  -1912126176},
        {-567170078,  1018257244,  400859960},
        {-726641626,  -956500428,  -569009224},
        {140061904,   -1302490898, -743659168},
        {-434221464,  -61093247,   505123432},
        {-1575153921, -1840112947, 7923763},
        {-632303875,  1363875007,  -824823101},
        {232199817,   2009230237,  640029957},
        {-52905036,   1527847041,  767784372},
        {1184901581,  1110144069,  2072717377},
        {1595989120,  -1301731473, -1319691392},
        {-1809431111, 126992611,   -1627155701},
        {1613738843,  -1485478565, 1481549913},
        {2033644107,  -338449153,  894876853},
        {1837330022,  -335529583,  1392917958},
        {1323170644,  325986050,   -1457667416},
        {-278767532,  -1319960206, -1285576344},
        {-709856898,  1258665704,  973893168},
        {2648841,     -852699069,  -1083204773},
        {-1177012335, -739460044,  1164297588},
        {-771168131,  -1497528254, -1810409414},
        {-2064343055, -604301532,  -1458559772},
        {-1948901914, -835323654,  1085145756},
        {1999167082,  -1147490010, 731663804},
        {1507833110,  -1463767336, 576044688},
        {-151432656,  456104074,   1375915488},
        {-2045102047, -859164675,  -297695331},
        {-1306203104, -2143706248, -1765339392},
        {-1731679422, -525704620,  1832613288},
        {-1464322740, -1778856413, 699560292},
        {-485793538,  -1254279449, -130016974},
        {1936439734,  1547487294,  198519316},
        {-448435062,  805975662,   1176354636},
        {1865931610,  -2070190673, 1211593862},
        {-428059031,  2055193385,  -2016226863},
        {-1641787023, -506403198,  1819074914},
        {-840173735,  -20962321,   1390221079},
        {284809204,   1372080671,  827174540},
        {256023919,   2076945541,  -613982549},
        {1658901342,  -671538753,  1231737122},
        {-896016512,  -72050893,   -1760164224},
        {257944758,   1185650204,  -993884184},
        {1433584323,  -1673632876, -958135876},
        {1356458444,  1636471911,  -691076844},
        {1348081332,  -569127250,  -488880552},
        {1641694658,  -1913170305, 115722046},
        {1857301306,  -572803007,  -1485919814},
        {-764129843,  487635551,   -1350577901},
        {-882293493,  1445366115,  -246770111},
        {-1930377667, -476832553,  1713973563},
        {1309570127,  1186132044,  843224948},
        {-834511942,  65317758,    -1214880884},
        {1754575235,  1713505646,  -1665018550},
        {-277257009,  -1847500314, -13500166},
        {-1630378848, 874524105,   -1025433184},
        {1509144492,  -1912527343, 1176418924},
        {-2047100293, 1284066940,  -393032300},
        {1485674535,  -793790428,  -336695940},
        {-1937740689, 90449310,    -850724990},
        {-387644924,  123562330,   -1513465496},
        {420208184,   49929294,    1762514192},
        {-116337803,  895405627,   -822156809},
        {-1009863135, 873211400,   185243400},
        {608279523,   316203020,   -1727926620},
        {1443320674,  360546618,   -276347340},
        {-1948642578, -1496759927, 1734381406},
        {993052355,   -2048627434, 796793794},
        {-1494647886, 234986193,   -256307118},
        {1805005188,  1069263018,  -1448640088},
        {533887052,   854081697,   2119215052},
        {-75321728,   24039213,    1544694912},
        {730665372,   1748998852,  -369274000},
        {858007951,   -828119654,  -1527059706},
        {1201338187,  928579018,   -982237138},
        {-742799060,  -1290293886, -398531496},
        {1471233039,  120515575,   -2116765831},
        {1292684887,  1047253278,  -867027662},
        {-1836379603, -1993477762, 1400393510},
        {-1665331524, 514014371,   -2054655564},
        {848120895,   -2127392785, -1026596911},
        {1037593877,  -302368550,  -106202142},
        {454731319,   -1414140692, -810619212},
        {1959195596,  1837964015,  1574720372},
        {-2097866077, 1317681187,  -1959506871},
        {-938773021,  169450888,   -1366435944},
        {-1492596686, -1323107209, 1925859134},
        {603118104,   139736857,   -9276328},
        {-1010750602, 276091008,   -446850304},
        {-330664893,  67895670,    -1276519966},
        {1305587947,  322640438,   -312725614},
        {-1378348797, 1307379369,  2060471547},
        {442950455,   -1255548440, 1789298904},
        {-1345022055, 5900037,     -1961483011},
        {-632964685,  -1384337294, 208388534},
        {-296458733,  -1982591877, 705818401},
        {-1078801623, -1900833618, 1956956638},
        {127323052,   -1409851605, -1562572316},
        {609446111,   90237994,    -1996699498},
        {31999346,    511356734,   -1307721828},
        {-1764301356, 1777597211,  -1203955364},
        {207184169,   -820606990,  1329625026},
        {1884720713,  950394770,   609991842},
        {608594543,   386424821,   626724155},
        {1128207234,  1381927917,  1320723802},
        {-355842528,  -968500489,  1870719200},
        {2038329293,  1019901071,  1812682627},
        {-1577508869, -123072390,  661056926},
        {-371358013,  -164567853,  -1272201543},
        {-664416635,  -1011880981, -1779193065},
        {756876749,   -1775882435, 241763545},
        {1950290221,  -1192625674, 105137726},
        {-287225622,  -1909183246, 621225268},
        {-1266676560, 1536767766,  720037664},
        {1156663214,  1346814058,  2067672588},
        {545368510,   868856682,   1066279596},
        {1829293709,  -1018081437, -1547541625},
        {-487540259,  1752506319,  1630080179},
        {-557938599,  -864196584,  -927600552},
        {2131166862,  1503172650,  1163617100},
        {-670917624,  1266812338,  -756243056},
        {1545842349,  -1003733243, 241892449},
        {-406658373,  -289003522,  -628526454},
        {515995165,   -1849655715, 1730817673},
        {932051451,   -555175327,  -99336677},
        {-460330076,  -1385299527, -798691964},
        {-1294027195, 1282590216,  2125008936},
        {375294226,   2097331582,  -1445084964},
        {-1387415096, -1256649885, -393056168},
        {-606654039,  -249063551,  1601811753},
        {1484731244,  1128505043,  735578628},
        {888648376,   1457489118,  624679824},
        {-2088826346, -237267807,  2072776662},
        {437267080,   427438343,   1533358520},
        {-1885472726, 1255688242,  35014708},
        {-1358530180, -1289649633, -663376380},
        {-687449263,  1207298680,  1979176952},
        {-537058957,  -188051832,  1741000472},
        {-2023244677, 1705116588,  -37874780},
        {-1770113168, 969398202,   1616074592},
        {193221671,   -1614685127, -215007057},
        {-181318787,  -1060905386, 1581040126},
        {-379842847,  1371668731,  1153734299},
        {-1490195765, 1355309946,  445212094},
        {-1671113204, -1096984920, -1351581728},
        {-1385783266, 644344663,   49148978},
        {-1812455199, -42110834,   216116430},
        {852006503,   1482970367,  -1889297255},
        {-1978003017, -1015210370, 306391570},
        {-1266269774, -41510013,   -140090346},
        {-834755708,  -835623416,  -346049504},
        {1111536194,  1007227965,  -1817599558},
        {-1762284637, -869508377,  -100061675},
        {790984186,   2134294121,  212397962},
        {-1397836841, 2079361726,  1026252690},
        {1413950461,  -1627949062, -99708910},
        {-1018040177, 1040379909,  624804555},
        {-210162023,  673852331,   -1981820109},
        {544986987,   -1623941059, 1524708479},
        {2065790816,  -651473837,  1214919712},
        {-50521602,   -65230485,   -1279620310},
        {1560420759,  217526653,   1328106939},
        {-1306982187, -1857170749, 2137093183},
        {-30527788,   1312631095,  -1041235060},
        {-1038572872, 1281045666,  1275877488},
        {-2089586206, -877571286,  -232852204},
        {946394159,   -344335423,  -1547490193},
        {230540263,   1698207978,  961427750},
        {-1948341433, 1270672295,  983558225},
        {1804986313,  -1754572913, 2055522375},
        {-165379179,  -1009978273, 2125649995},
        {-1977565236, -1918857596, -1631187664},
        {838823547,   -1714262165, -896499095},
        {522828159,   326936478,   -1169795742},
        {1733057450,  -1034512392, -1155132752},
        {1494062040,  1260137584,  -1090924928},
        {461948391,   1381831250,  1386521086},
        {1997071262,  -710673187,  -430569626},
        {-1330452464, 1277957785,  -1650585200},
        {1186986503,  914741998,   -1593350014},
        {-24527263,   -2090855755, -1373213547},
        {-921955935,  1868652516,  105607780},
        {334845939,   1296234374,  -303202766},
        {-93067916,   1079422609,  -1231958348},
        {602160262,   221160800,   1051529280},
        {-1720445336, -803113245,  -139735496},
        {41085567,    -1656411210, 575736650},
        {404620004,   1168645825,  211215844},
        {-1593921229, 1094766612,  -1012971524},
        {-438700872,  -1424743399, 521324024},
        {1779788645,  -1765207982, -773867942},
        {1132710204,  910560313,   -466706852},
        {-1119363571, -1546054650, -1928513458},
        {-1645774919, 1288205406,  1371916782},
        {-1627603109, 999768378,   159806878},
        {1528109574,  -1618274422, -638021316},
        {-977360390,  -339416994,  125106636},
        {1683643254,  -169353830,  -724966660},
        {-715161447,  736639872,   -267677824},
        {-349605391,  1828800407,  1123879975},
        {-454031962,  -1161689927, 358001910},
        {-1055652512, 1638583627,  -1964281056},
        {1999809372,  -909914134,  -1342962152},
        {-1937594034, 352387095,   -1358219774},
        {840753151,   -1873642584, -230652840},
        {-2093495093, -1746893052, 1753104428},
        {-1049994650, 485254516,   400766008},
        {-1690876780, 885540887,   551602508},
        {242887354,   671720751,   -159270362},
        {815387504,   -1952165144, -1797161600},
        {-52063364,   1862273996,  675797712},
        {1969640668,  -725327755,  805783692},
        {331149004,   -878978745,  -111860076},
        {100691434,   1360657459,  1679965598},
        {1465328615,  582573525,   -210056653},
        {995551333,   721922662,   -1397315010},
        {1264873713,  540736092,   -453119844},
        {972692537,   -439640143,  -878187927},
        {-658666252,  -59100124,   1469145680},
        {-588969199,  -1222255120, -1849881360},
        {578053672,   -1643524145, 1109455448},
        {-364244414,  -1602041275, 501415882},
        {842793076,   -309713018,  302115000},
        {442390247,   -1011599,    1175866359},
        {-1852753868, 800075893,   -240619580},
        {1512919116,  1589045092,  456126896},
        {728132924,   1991435128,  -963155936},
        {19928207,    281938710,   -1508513462},
        {1034967581,  1868168470,  2102093694},
        {-302363772,  1860894615,  1854080732},
        {1129487270,  -500938579,  703717166},
        {1460202457,  295989605,   -962341475},
        {-372331347,  -1783960849, -1918150781},
        {-1629673862, 143967997,   450454162},
        {-1291822577, -406167668,  -1636642508},
        {1481647158,  -107792460,  -1591537672},
        {1851716340,  1987124784,  -2013649472},
        {2008185250,  -614007866,  -1646794420},
        {1592441175,  -897639760,  -1336196656},
        {689206589,   1777658287,  1993648563},
        {-1889380667, -702507905,  -2104299589},
        {172141524,   -518449991,  -1152467916},
        {1842633060,  -1614681754, -2007260712},
        {1507092264,  878919894,   902839152},
        {1985805622,  -94281868,   -779106696},
        {-1302340915, 637943727,   355271971},
        {723568031,   1054808626,  1744420622},
        {-339590316,  -340292868,  143756976},
        {1234742052,  -1757761765, 574597324},
        {-358067284,  -1371688939, -783213284},
        {-1823678091, 1202785610,  -795796270},
        {1382388933,  625041609,   143699629},
        {1449621933,  564440181,   1121900561},
        {-319841419,  -169984658,  -1351242426},
        {1767400663,  -865781991,  1679755775},
        {180107423,   -1129468871, -513380505},
        {-2007459149, 529212406,   -830725886},
        {1452279697,  -858304049,  2007105343},
        {-63805254,   1827599038,  -1454010868},
        {-2109931858, -2108162277, 1732259418},
        {1938894176,  1149960200,  -1079416064},
        {-1893276084, 2003380322,  -1442051816},
        {-746912872,  504505482,   1568755696},
        {845011423,   956316052,   -1429955604},
        {213590685,   167023495,   -1372362805},
        {1048393558,  234773475,   822584130},
        {1395389934,  1764732038,  -688872812},
        {125804741,   -1390509927, 1136629181},
        {1161572761,  -136530876,  -178732892},
        {882832451,   272155942,   -1070083854},
        {100296380,   -1388467989, 1460907668},
        {1684102677,  -45120392,   195161560},
        {648469576,   71738755,    -1358094120},
        {-983373557,  4958607,     -732860379},
        {-1501319160, -862615385,  1779701048},
        {1434267946,  -527231152,  -240639200},
        {-1265138719, 1152438908,  843215612},
        {-1092281206, -1526908520, -138040336},
        {798440283,   -1098781217, -376769723},
        {-772751743,  -732490861,  -46663917},
        {-797995681,  -1383180067, -426265853},
        {-793392895,  1105813327,  278488655},
        {875523650,   -1363779481, 123346062},
        {970141758,   -1584885109, 1981713834},
        {-1767860734, -1032363194, -1998992756},
        {1874781331,  -1361060651, 206537295},
        {2146150094,  -1340420020, 40428840},
        {-1675966810, -1792707885, -360339758},
        {830060491,   -384150581,  532254457},
        {19020233,    -1200112928, 811440608},
        {-1994569707, -1953175477, -938793433},
        {-1334576989, 503852762,   -125369138},
        {-374809085,  -2009612682, 1396805474},
        {1553076239,  -1657665735, -253494185},
        {-1917200722, -558288809,  170300706},
        {-609475517,  1055392612,  -362613972},
        {1356999092,  993211331,   1970315292},
        {-2065275851, -876223681,  592881675},
        {1287923001,  -1852964841, -734177249},
        {126996281,   1757898248,  -1838272568},
        {-1084266962, 704830243,   516969034},
        {-873418514,  1081074275,  -1854371830},
        {771657941,   -1513471643, 1497839881},
        {-1855162533, -548746318,  -446814650},
        {19500420,    76012921,    476764004},
        {1959806804,  6207658,     1986772424},
        {1375227304,  -2059795760, 1785358464},
        {342749986,   -1112424669, 133208998},
        {-60924660,   932814752,   -2031051904},
        {1313421154,  999766318,   -1622489700},
        {1959248731,  1077074459,  1429411993},
        {1606378029,  275531628,   -1275861508},
        {1306786275,  -1320301342, -1968538010},
        {-1394620295, -1897290595, -171149771},
        {-972818021,  -1606281540, -61562924},
        {2047585726,  1015455351,  1780287314},
        {1446815079,  -246992510,  1023784270},
        {-1564835364, -1194178632, 1451842080},
        {-657517415,  -1904294818, 689746990},
        {782866747,   459618174,   346822666},
        {-194215493,  823485748,   -460316420},
        {1368179507,  -715167274,  -962062430},
        {-1761353333, 271154527,   -1093365355},
        {1120363182,  -963963502,  -1723298500},
        {958621254,   669992352,   1711983040},
        {-1190400756, -562656418,  396267112},
        {-1294437591, 126094674,   -950929374},
        {456782662,   207909397,   1500389566},
        {-1331903436, 1280458978,  1679439336},
        {1924208981,  -1089276848, -696848752},
        {1787285041,  -99949697,   756989263},
        {1305583572,  -330321088,  -912969472},
        {2112330484,  2102423565,  1221434980},
        {1640588260,  -1051225411, -484260012},
        {-1848334877, 1484412254,  1029130330},
        {1398176079,  1163834014,  1706675394},
        {1720220856,  -1399357021, 1078468904},
        {2098643695,  -2138166965, -344628475},
        {-1116264315, 675918112,   1742079392},
        {1368272208,  411718543,   -1807990864},
        {430416632,   2038068254,  -642942704},
        {2105765780,  -781333070,  -608102168},
        {482860000,   2038833190,  946250560},
        {-1091733865, 1548904902,  1370204106},
        {1916605167,  -1400364949, 81578469},
        {1806294610,  1145222977,  -583921454},
        {104434113,   -952673913,  -390939193},
        {1943477636,  1694756812,  -1870282448},
        {804049436,   712545386,   -693686376},
        {-1137490034, -36610727,   -809470370},
        {2071215225,  1001923727,  -1469658217},
        {-1752528738, 1377799547,  1139845610},
        {-1501222205, 1148927343,  1184825741},
        {-380714992,  -1525750287, -439279856},
        {-232567970,  -710104262,  1216273740},
        {-1188831984, -962957693,  -2114519248},
        {810614890,   1127211716,  1373103400},
        {1036181891,  218686481,   1575069107},
        {2127066952,  -1786733379, 1320153128},
        {1330622247,  1861445864,  1130599256},
        {-1011862436, -1462472667, 462410060},
        {-732167432,  328623703,   -104607160},
        {388372244,   781656062,   -916303400},
        {-879476011,  2102817665,  -1538696107},
        {-391636439,  -294547390,  874958482},
        {-1531379357, -424913547,  -1769504449},
        {34755621,    848729623,   1956724051},
        {1750228017,  1363700859,  1295972235},
        {1868430372,  1863325504,  -1486469888},
        {-726099939,  -2089868624, -1901105680},
        {-1295681826, 1350184151,  437320818},
        {-622878731,  -174772267,  -1123610151},
        {-1263685660, -884916935,  309951940},
        {1812547936,  -883177885,  729260064},
        {1039483689,  206782784,   1974022976},
        {492602367,   -59114014,   -1046050274},
        {-162645309,  1317251255,  -465241755},
        {-174205233,  -48099718,   -915033946},
        {1330603251,  1206161930,  -1374124162},
        {-1775775792, -2025442870, -1659844064},
        {875988578,   -951105219,  -1550977190},
        {-1861727765, -1207288584, 1015590824},
        {103083181,   260129311,   -1448459533},
        {-49173232,   -202618872,  -1678120832},
        {1630807331,  -774766146,  1653519098},
        {1945996446,  -234883471,  -1486035522},
        {1750653901,  1641655069,  715642169},
        {-2135930872, -1069730579, 465325928},
        {820389550,   -861461724,  992557688},
        {-494693964,  1906081936,  1888220480},
        {719569227,   346030039,   -865727747},
        {-663224282,  -1345844452, -321804760},
        {-1517421459, -1911310646, -980046846},
        {848039261,   1858752658,  426684170},
        {1736336932,  -1959870764, 1794330064},
        {578365565,   647492108,   -1783689252},
        {-1670877681, 2006030595,  -1904262867},
        {-2046968403, -170137142,  2144935810},
        {2001045979,  -1348799281, 1532834837},
        {-1511696318, -129340279,  -66317486},
        {-75457016,   -1263311983, 1351522952},
        {-2073148643, -1976562661, 1513517071},
        {-1838633229, -2116268235, 1769813327},
        {-708949168,  -1606947020, 1093073984},
        {-802218480,  1235953710,  1775888096},
        {-2079422201, 1321022081,  -1371444601},
        {87422838,    -1678442838, 1339385948},
        {961565349,   -190265602,  2112200118},
        {-1581837408, 352189190,   799561152},
        {1066122797,  -1407295096, 982652136},
        {-1022029455, 1027828100,  -1198041276},
        {844780771,   -330281039,  2073476595},
        {2008247416,  254692667,   327817128},
        {1827069234,  83576275,    -1544762826},
        {-532466827,  -899174834,  126235558},
        {-217751856,  -91719065,   -724023888},
        {-1740233956, -496560288,  1069067904},
        {1199883551,  -1964662121, 1053352777},
        {56764696,    845608519,   1397126568},
        {1477297110,  -603479023,  -315025098},
        {-834956462,  1802621951,  -722053970},
        {1710809568,  -1358557155, -2037410208},
        {808218482,   1425446880,  -601243200},
        {-977285500,  1795865585,  -2104240572},
        {462675621,   -729724397,  -1619380161},
        {38560965,    -80606653,   1801982351},
        {1692426657,  1494812994,  1728107650},
        {-1733689078, 925743648,   -289184448},
        {421814501,   -1046796402, -862477818},
        {834931970,   1497714428,  -327325192},
        {1681159493,  -562650426,  -1768530594},
        {891741633,   711747081,   -178980407},
        {-398248795,  1974102997,  -1250048951},
        {1734770734,  -271020853,  623955066},
        {-1377401084, 387723642,   539237352},
        {1126199201,  2047175916,  2032391276},
        {-2018588740, -293297601,  -1017635004},
        {46478024,    -995139252,  1635834720},
        {406337287,   579426723,   1470855285},
        {766438090,   2134493276,  -1891356520},
        {-1859944507, -1251218279, 676853949},
        {-1698045779, 1182246828,  1872678716},
        {-1259711109, 1983433013,  -695646857},
        {-1871348484, -652053311,  1521314300},
        {-514756962,  -1999118940, 2069578552},
        {713725347,   -1196157140, 568286468},
        {-1400283374, -1156826531, 1749654922},
        {-690080226,  1712748503,  1515939122},
        {1881413357,  328147862,   162190814},
        {1147553234,  1038889377,  -12117230},
        {-2095249025, 1246119416,  644509192},
        {-208162630,  945501997,   -356514126},
        {-1416740714, -1671691627, -1808481458},
        {-169085370,  -444890633,  526771082},
        {-913514499,  1610352153,  1544408501},
        {-1057602945, -1491525977, 332874457},
        {-78914234,   -119169217,  -1246237126},
        {357463406,   -1281742167, 2117833118},
        {-1756631095, 740853895,   601242367},
        {1293597886,  30316285,    2095569862},
        {-1337197332, 360192293,   -783377892},
        {1197908896,  326681675,   324562912},
        {1209894051,  650907964,   -1063392972},
        {251706606,   968576058,   -1642367508},
        {-2034970054, 314930507,   -173008642},
        {730221459,   -2071360511, -628772973},
        {-502991534,  1858153703,  -76188418},
        {-1009349335, 167625789,   -524810555},
        {229885736,   1374247082,  -784334704},
        {-1063417117, -1655643643, 1973427311},
        {934445085,   -2043571349, 2058957599},
        {2118161580,  -1000520389, 863018916},
        {-1131699854, -969305425,  -1545051922},
        {1165281936,  -1353246683, 1137624784},
        {1409234770,  1926552158,  -2135284708},
        {1131042907,  -302379973,  226795769},
        {949139221,   -1951565895, 894570797},
        {-1946335361, 1897238594,  2079252158},
        {-79036990,   593688459,   2135357014},
        {1812400954,  1146999705,  -628587606},
        {1410544342,  266734494,   -313748972},
        {-168154376,  335096530,   92008304},
        {398955331,   -18574480,   -1567889840},
        {-509366539,  -1733908093, 1881162847},
        {-1707120453, 320928807,   -484374403},
        {394539814,   366216542,   -1325234700},
        {-1239961299, -1379193919, 709763565},
        {988595289,   734402175,   1680543271},
        {-794019185,  1705012111,  -1861322015},
        {1244261274,  -296187643,  181863426},
        {-810469666,  2147157475,  -1914700582},
        {-1412854823, -603024413,  820157547},
        {-1291613086, -1924035832, -363357936},
        {1370387913,  1920452855,  1573367023},
        {-2131270090, 1311830386,  -209430004},
        {-1200695798, -2121706916, 1572741016},
        {1373686023,  1857815862,  1283164794},
        {-1851203191, 1757229308,  917287644},
        {1896493083,  1483594427,  48701881},
        {-1664392153, 1271812200,  1179574232},
        {-368478571,  -1417398095, -1907387131},
        {965088664,   1392608235,  -927294840},
        {564367607,   1850879298,  -37434706},
        {1676662925,  -782712613,  -300941153},
        {-1116480793, -1475722616, -1459496776},
        {984565781,   -485545421,  1257885231},
        {-1785463499, -1584200130, 1815449814},
        {-1118554304, -980303522,  -1915516544},
        {1942859804,  284154041,   1717560380},
        {-757659899,  -384708523,  -1150393175},
        {1018158535,  -571263208,  -939029592},
        {-1206061467, -133472021,  1297288887},
        {-864753385,  1217328314,  -1109571914},
        {-223424305,  -873769625,  -2102411703},
        {1547705507,  90839024,    1227587024},
        {-1363042618, 1420162643,  83279410},
        {-132872705,  1537953267,  -836901875},
        {-813220672,  -993523309,  1640669760},
        {994558273,   -1704842728, 1766901784},
        {-675873711,  429508280,   1209335864},
        {-1000900415, -68639679,   -1921430271},
        {2090644361,  680279190,   1423003206},
        {842046751,   -1791391081, -700030135},
        {570351257,   1570700307,  1618420059},
        {-530343543,  -2049975691, -1324690019},
        {2131933116,  49617985,    -1631242564},
        {1571883069,  -1116851033, -1486961717},
        {1052731731,  1303243695,  -1096863555},
        {-452023475,  1198317779,  1081512055},
        {-304103854,  679928571,   793771622},
        {486321569,   -1038085065, -1376132713},
        {-79432485,   1058122924,  -1581865180},
        {2013229122,  332361620,   -860388312},
        {-718563545,  -1381870018, 1191425394},
        {-1282250795, 1490217065,  -1176527267},
        {1493794477,  -809042307,  -1038057351},
        {-718483868,  -1359441564, -1891155184},
        {1122133372,  1650169110,  261743784},
        {1597582692,  -593889771,  -770518732},
        {599304684,   -731807894,  959344568},
        {1181549555,  -989921820,  1830333292},
        {-1736562571, -1947453787, -1196113559},
        {-218231456,  1125616197,  -984655136},
        {523194334,   -1074711793, 313321474},
        {-1794708496, -294370263,  -1115190928},
        {2085147545,  -1780827999, -1087567047},
        {-1874510881, -1074115401, -2012610455},
        {1241227373,  -2019403557, -916343489},
    };
    //</editor-fold>

    for (auto & example : examples)
    {
        EXPECT_EQ(aeron_mul_wrap_i32(example[0], example[1]), example[2]);
    }
}

